import React, { Component } from 'react'
import { HashRouter as Router, Route, Switch,Redirect} from "react-router-dom"
import NotFound from './NotFound';
import ShoppingCar from '../shoppingcar/ShoppingCar';
import  Page from '../Page/Page'
import Usercontorl from '../usercontorl/Usercontorl';
import Lianxi from '../lianxi/Parent'
export default class RouterView extends Component<any,any> {
    constructor(props:any){
        super(props);
        this.state = {
            list:[{
                path:"/",
                component:ShoppingCar,
                exact:true
            },{
                path:"/Page",
                component:Page,
            },{
                path:"/Usercontorl",
                component:Usercontorl,
            }
            ,{
              path:"/lianxi",
              component:Lianxi,
          }]
        }

    }

  render() {
    return (
        <Router>
        <Switch>
          {/* <Route path="/" component={Home} exact></Route>
          <Route path="/about" component={About}></Route>
          <Route path="/user" component={User}></Route> */}
          {this.state.list.map((item:any)=>{
            return  ( <Route key={item.component} path={item.path} component={item.component} exact={item.exact}></Route>)
          })}
          <Route path="/404" component={NotFound}></Route>
          <Redirect path='*' to="/404"></Redirect>
        </Switch>
      </Router>
    )
  }
}
